import { observable, action } from 'mobx'
// import * as api from 'lib/constants/api'
// import { post } from 'lib/net'
// import Toast from 'components/toast'

// class AddressModel {
//   constructor (data) {
//     if (data) {
//     }
//   }
// }

export default class AccountPresentVM {
  constructor (props) {
    this.props = props
    this.PageInitialization()
  }

 // 定义取款方式
  @observable cashType = ''

 // 取款银行
  @observable bankName = ''

 // 定义银行卡号
  @observable bankNum = ''

 // 银行卡LOGO
  @observable bankIcon = ''

 // 微信昵称
  @observable wxNickName = ''

 // 微信头像
  @observable wzHeadKey = ''

  // 选择提现方式
  @action handleChooseMode = (buttonIndex) => {
    if (buttonIndex === 1) {
      window.sessionStorage.setItem('viewBox', 'true')
      this.props.history.push('/bindWeChat')
    } else if (buttonIndex === 0) {
      this.props.history.push('/bindBankCard')
    } else {
      return false
    }
  }

  // 返回提现页面
  @action handleBackWithdraw = () => {
    this.props.history.push('/withdraw')
  }

  @action PageInitialization = async () => {
    let arrWithDraw = this.props.history.location.search.split('?')
    this.cashType = arrWithDraw[1]
    this.wxNickName = arrWithDraw[1]
    this.bankName = arrWithDraw[2]
    this.wzHeadKey = arrWithDraw[2]
    this.bankNum = arrWithDraw[3]
    this.bankIcon = arrWithDraw[4]
  }
}
